﻿using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;

namespace TestApplication
{
    class Program
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
        public static extern void OutputDebugString(string s);

        static void Main(string[] args)
        {
            Thread threa = new Thread(delegate()
            {
                Form frm = new Form() { Text = "abc", Width = 400, Height = 300 };
                Application.Run(frm);
            });
            threa.SetApartmentState(ApartmentState.MTA);
            threa.Start();
            Console.ReadKey(true);
            Console.Write("abc");
        }
    }
}
